from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import datetime


class DictItemResponse(BaseModel):
    id: Optional[int] = Field(None, description="字典项ID")
    dict_key: str
    dict_value: str
    dict_type: str
    category: Optional[str] = None
    score: Optional[int] = 0
    options: Optional[str] = "N"
    sort_order: Optional[int] = 0
    create_time: Optional[datetime] = None
    update_time: Optional[datetime] = None

    class Config:
        from_attributes = True


class DictItemListResponse(BaseModel):
    total: int = Field(..., description="总数量")
    items: List[DictItemResponse] = Field(..., description="字典项列表")
    page: int = Field(..., description="页码")
    size: int = Field(..., description="每页数量")
    pages: int = Field(..., description="总页数")